package org.gpp.proj1.robot.action.step;

import java.util.List;

import org.gpp.proj1.robot.Robot;
import org.gpp.proj1.robot.part.EquippedPart;

/**
 * Action that changes a robot's animation
 *  
 * @author Paolo Victor, paolovictor@gmail.com
 */
public class SetAttackAnimationActionStep implements ActionStep {

	private String animationName;

	/**
	 * Default constructor
	 * @param target
	 * @param animation
	 */
	public SetAttackAnimationActionStep( String animationName ) {
		this.animationName = animationName;
	}
	
	/**
	 * Executes the action
	 */
	public void execute( EquippedPart parent, List<Robot> targets ) {
		if( parent.getParentRobot() != null ) {
			parent.getParentRobot().setAnimation( parent.getAssignedGroup() + animationName );
		}
	}
}